package com.jushu.storbox.entities;

import android.content.ContentValues;
import android.database.Cursor;

import com.jushu.storbox.database.IObjectConvert;
import com.jushu.storbox.database.IPreUploadDao;

public class PreUploadObject implements IObjectConvert {

	private String ownerId = null;
	private String folderId = "0";
	private String identity = "";
	
	private String filePath = "";
	private long uploadTime = 0;
	
	public String getOwnerId() {
		return ownerId;
	}
	public void setOwnerId(String ownerId) {
		this.ownerId = ownerId;
	}
	public String getFolderId() {
		return folderId;
	}
	public void setFolderId(String folderId) {
		this.folderId = folderId;
	}
	public String getFilePath() {
		return filePath;
	}
	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}
	public long getUploadTime() {
		return uploadTime;
	}
	public void setUploadTime(long uploadTime) {
		this.uploadTime = uploadTime;
	}
	
	public String getIdentity() {
		return identity;
	}
	public void setIdentity(String identity) {
		this.identity = identity;
	}
	
	@Override
	public void fromCursor(Cursor cursor) {
		setOwnerId(cursor.getString(cursor.getColumnIndex(IPreUploadDao.OWNER_ID)));
		setFolderId(cursor.getString(cursor.getColumnIndex(IPreUploadDao.FOLDER_ID)));
		setIdentity(cursor.getString(cursor.getColumnIndex(IPreUploadDao.FILE_IDENTITY)));
		setFilePath(cursor.getString(cursor.getColumnIndex(IPreUploadDao.LOCAL_FILEPATH)));
		setUploadTime(cursor.getLong(cursor.getColumnIndex(IPreUploadDao.UPLOAD_TIME)));
	}
	@Override
	public ContentValues toContentValues() {
		ContentValues cv = new ContentValues();
		cv.put(IPreUploadDao.OWNER_ID, getOwnerId());
		cv.put(IPreUploadDao.FOLDER_ID, getFolderId());
		cv.put(IPreUploadDao.FILE_IDENTITY, getIdentity());
		cv.put(IPreUploadDao.LOCAL_FILEPATH, getFilePath());
		cv.put(IPreUploadDao.UPLOAD_TIME, getUploadTime());
		return cv;
	}
	
	
}
